package com.oepm.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oepm.biz.EstabListBiz;
import com.oepm.dao.entity.EstabListPo;
import com.oepm.dao.entity.QueryInfo;
import com.oepm.dao.mapper.EstabListMapper;
import com.oepm.vo.DataVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EstabListBizImpl implements EstabListBiz{
    @Resource
    EstabListMapper estabListMapper;

    @Override
    public DataVo selectAll(QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<EstabListPo> list = estabListMapper.selectAll();
        PageInfo<EstabListPo> info = new PageInfo<>(list);
        return new DataVo(info.getTotal(),info.getList());
    }

    @Override
    public DataVo selectByTeaId(QueryInfo queryInfo, String userId) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<EstabListPo> list = estabListMapper.selectByTeaId(userId);
        PageInfo<EstabListPo> info = new PageInfo<>(list);
        return new DataVo(info.getTotal(),info.getList());
    }

    @Override
    public List<EstabListPo> selectByName(String pname) {
        return estabListMapper.selectByName(pname);
    }

    @Override
    public int updateStuInfo(EstabListPo estabListPo) {
        return estabListMapper.updateStuInfo(estabListPo);
    }
}
